-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize unary handlers with persistent connections to P2P daemon #328
Conversation
Codecov Report
@@ Coverage Diff @@
## master #328 +/- ##
==========================================
+ Coverage 83.22% 83.40% +0.17%
==========================================
Files 66 66
Lines 6002 6139 +137
==========================================
+ Hits 4995 5120 +125
- Misses 1007 1019 +12
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- in DaemonConnector create_persistent_connection, await an ok message from daemon to ensure that it was created successfully before returning connection
- add a test that attempts to call: (1) non-existing unary handler (2) existing handler with wrong protobuf types (3) self-dial [non-]existing handler. Ensure that it raises error instead of hanging
- p2pd: do not send ok (p2pd->pyclient) on receiving unary response
- update p2pd versions (merge libp2p master into ours) - libp2p/go-libp2p-daemon@193eab6
- print warning on any unexpected messages over persistent connection
hivemind/p2p/servicer.py
Outdated
@@ -131,6 +131,7 @@ async def add_p2p_handlers(self, p2p: P2P, wrapper: Any = None, *, namespace: Op | |||
getattr(servicer, handler.method_name), | |||
handler.request_type, | |||
stream_input=handler.stream_input, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicking: should we create them asynchronously via gather
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
upd: this is definitely not a bottleneck, feel free to ignore/resolve
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I support this because it may improve startup time. Good catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
Just in case, the |
Co-authored-by: Alexander Borzunov <[email protected]>
… into unary-handlers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving this. We have also decided to revert the first change from learning-at-home/go-libp2p-daemon#11 in a future PR (it is unnecessary but increases startup time).
This PR implements unary handlers over a persistent daemon connection.
The daemon part (Golang): learning-at-home/go-libp2p-daemon#3